package com.itsv.news.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.itsv.news.R;

public class GvRssAdapter extends BaseAdapter {

	private Context con = null;
	private LayoutInflater inflater = null;
	private String[] rssname = null;
	private TextView tv = null;

	public GvRssAdapter(Context con) {
		this.con = con;
		inflater = LayoutInflater.from(con);
	}

	public void setData(String[] rssname) {
		this.rssname = rssname;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return rssname.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		if (convertView == null) {
			convertView = inflater.inflate(R.layout.gv_rss_item, null);
			tv = (TextView) convertView.findViewById(R.id.tv_gvrssitem);
			tv.setText(rssname[position]);
		}
	
		return convertView;
	}

}
